#include "GameOverState.h"


GameOverState::GameOverState(GameContext& gc)
	: GameState(gc)
	, mGameOverMusic()
{
}


GameOverState::~GameOverState(void)
{
}


void GameOverState:: Load()
{
	// load background
	char backgroundName[256];
	sprintf_s(backgroundName, 256, "gameoverscreen.jpg");
	background.Load(backgroundName);

	// load font
	mFont.Load(24);
	mCursor.Load("gun_cursor.png");

	// load buttons
	mQuitButton.Load("button_on.png", "button_off.png");
	mQuitButton.SetPosition(SVector2(445.0f, 700.0f));
	mQuitButton.SetText("Main Menu", 0, 162, 242);

	// load sound
	mGameOverMusic.Load("gameovertheme01.mp3");

	// play music once
	mGameOverMusic.Play(true);

	// 0, 162, 232
}

void GameOverState:: Unload()
{
	background.Unload();
	mFont.Unload();
	mCursor.Unload();
	mQuitButton.Unload();
	mGameOverMusic.Unload();
}

NextState GameOverState:: Update(float deltaTime)
{
	mCursor.Update(deltaTime);
	mQuitButton.Update(deltaTime);

	NextState nextState = None;
	if (mQuitButton.IsPressed())
		nextState = Frontend;

	return nextState;
}

void GameOverState:: Render()
{
	background.Render();
	mQuitButton.Render();
	mCursor.Render();
}